const Koa = require("koa");
const koaBody = require('koa-body');
const koaStatic = require("koa-static");
const cors = require("koa2-cors");
import "reflect-metadata";
import { router } from "./middleware/request";
import connectionDatabse from "./server/database";
import { PUBLIC_PATCH, PORT } from "./config";
import path = require("path");
const app = new Koa();
// 连接数据库
// const db = connectionDatabse();

// 接口文件
import "./api/controllers/UploadFile";
import "./api/controllers/WxServer";
// app.use(koaStatic(__dirname + '/public'));
app.use(koaStatic(PUBLIC_PATCH));
app.use(koaBody({ multipart: true }));
app.use(cors());
app.use(router.routes())
const server = app.listen(PORT || 3000, () => {
    console.log(`服务器启动成功：http://127.0.0.1:${PORT}`);
});
export default app;

